package org.zhouhe.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.OrderBy;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ReportType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "report_type", catalog = "zpd0t1_db")
public class ReportType implements java.io.Serializable {

	// Fields

	private static final long serialVersionUID = -7922094946017756596L;
	private Integer reportTypeId;
	private ReportType reportType;
	private String idPath;
	private String name;
	private String logo;
	private Integer orderId;
	private Integer status;
	private Set<ReportType> reportTypes = new HashSet<ReportType>(0);
	private Set<Report> reports = new HashSet<Report>(0);

	// Constructors

	/** default constructor */
	public ReportType() {
	}

	/** full constructor */
	public ReportType(ReportType reportType, String idPath, String name, String logo, Integer orderId, Integer status, Set<ReportType> reportTypes,
			Set<Report> reports) {
		this.reportType = reportType;
		this.idPath = idPath;
		this.name = name;
		this.logo = logo;
		this.orderId = orderId;
		this.status = status;
		this.reportTypes = reportTypes;
		this.reports = reports;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "report_type_id", unique = true, nullable = false)
	public Integer getReportTypeId() {
		return this.reportTypeId;
	}

	public void setReportTypeId(Integer reportTypeId) {
		this.reportTypeId = reportTypeId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	public ReportType getReportType() {
		return this.reportType;
	}

	public void setReportType(ReportType reportType) {
		this.reportType = reportType;
	}

	@Column(name = "id_path", length = 256)
	public String getIdPath() {
		return this.idPath;
	}

	public void setIdPath(String idPath) {
		this.idPath = idPath;
	}

	@Column(name = "name", length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "logo", length = 256)
	public String getLogo() {
		return this.logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	@Column(name = "order_id")
	public Integer getOrderId() {
		return this.orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "reportType")
	@OrderBy("reportTypeId")
	public Set<ReportType> getReportTypes() {
		return this.reportTypes;
	}

	public void setReportTypes(Set<ReportType> reportTypes) {
		this.reportTypes = reportTypes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "reportType")
	public Set<Report> getReports() {
		return this.reports;
	}

	public void setReports(Set<Report> reports) {
		this.reports = reports;
	}

}